package org.homly.admin.action.order;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.homly.admin.form.OrderForm;
import org.homly.model.Order;
import org.homly.service.OrderService;

public class SaveOrderAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		OrderForm orderForm = (OrderForm) form;
		Order order = new Order();

		BeanUtils.copyProperties(order, orderForm);

		OrderService.updateOrder(order);

		return new ActionForward(mapping.findForward("manager_order").getPath(), true);
	}

}
